-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CMake support #73
Conversation
I'm not sure about the submodules. What about using FetchContent? Isn't that supposed to be the new way to do this? |
+1 for FetchContent (this is how we integrate abseil-cpp, protobuf and pybind11 in google/or-tools) also you should provide a note: up to know we were using SWIG to wrap in our CMake based build, now we are slowly migrating to pybind11 and also add these new pybind11 wrapper to our bazel based build also. So I should work on it for Q2 2022 (next week hopefully) |
ec0d86e
to
eea7c8e
Compare
Had cause to revisit this and have updated using FetchContent (loosely based on google/or-tools as per suggestion above). Happy to restructure as needed. |
Thanks, LGTM, with my extremely superficial cmake background. I could now do the manual step to get this merged ("submitted" is our actual term) internally, as I outlined before (#60 (comment)), which will then trigger the automatic export. But before I do so, one quick question: It's not great that we don't have any testing. Are you interested in adding a minimal GHA workflow (e.g. just one platform) to exercise the new cmake files? In this PR, or separately? |
Sure, I’ll put together a workflow for Ubuntu latest that does a build and runs the tests. I have one question about which versions of the dependencies to pin to in FetchContent. I have used the versions used in the or-tools project rather the the versions in this projects Bazel files because the latter combination had build issues on macOS. If consistency across build systems is needed then there’s a bit more to do there as well. |
Awesome, thanks!
My feeling: "more to do" can wait (future PR). @laramiel what do you think? General purely practical consideration:
|
@mjcarroll - actually I think that's with me to put together a minimal workflow using the cmake build. If you're thinking of using this for gz-msgs and gz-transport bindings I'll get back on to it. |
Nice! (Let me know if simply integrating this PR would help, even though "no testing" means no assurance that it won't break.) |
@rwgk if you're ok with merging this as is that would help for sure. I'll raise an issue for the ci workflow which you can assign to me if you like. |
Is there a reasonably easy way to print out a warning when cmake is run (the initial configure step)? Something like:
|
Sure - the following should do it. I'll add it in.
Output is: % cmake ..
CMake Warning at CMakeLists.txt:18 (message):
CI testing for pybind11_protobuf cmake is currently MISSING!
(https://github.com/pybind/pybind11_protobuf/issues/104)
-- Build abseil-cpp: ON
-- Build protobuf: ON
-- Python: Build pybind11: ON
-- Fetching Abseil-cpp
... |
Thanks, looks great! I'll try to pull this in asap. |
GHW for cpplint, cppcheck and build on https://github.com/srmainwaring/pybind11_protobuf/tree/feature/cmake-ci. It is a branch off this PR. I noticed that for the an ubuntu build the dependencies need to be built with `CMAKE_CXX_FLAGS="-fPIC". This can be done either on the command line when calling cmake, or defined in the top-level CMakeLists.txt, which is what I've done for the follow up PR. If you prefer I can push the CI changes to this branch (and remove the warning). |
I tried to establish basic pre-commit checks, including cmake-format: #105 I don't really know what I'm doing but it seems to work as a start. Note that your cmake files have a lot of whitespace changes. Idea from here: I could remove your cmake files from #105 again and merge the rest. Then you could rebase this PR, then run And yes: pushing the CI changes here would be ideal. How does that sound? |
Preparation for importing #73 PiperOrigin-RevId: 512739514
Preparation for importing #73 PiperOrigin-RevId: 512739514
@rwgk - could you trigger/approve the GHW pls. |
Update: This PR and #108 (auto-force-pushed from Google-internal change list) are exactly identical again. |
Merged via #108. |
Hi @rwgk - thanks for getting this reviewed and merged. I noticed that my authorship has been stripped from the commits in |
Small update: we tried very hard to convince our copybara tool to respect some original author setting, but it stubbornly keep using my name (#110). Will try more tomorrow (hopefully). |
Thanks @rwgk - much appreciated. |
This PR adds support for the CMake build system.
Addresses #60
Discussion points
git submodule. This may result in conflicts for downstream CMake projects where these dependencies are resolved from system installs or are independently included in submodules.Tasks